<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <link rel="stylesheet" type="text/css" href="http://res.wisedu.com/fe_components/iconfont/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="http://res.wisedu.com/fe_components/jqwidget/blue/bh.min.css" />
    <link rel="stylesheet" type="text/css" href="http://res.wisedu.com/fe_components/jqwidget/blue/bh-scenes.min.css" />
    <link rel="stylesheet" type="text/css" href="http://res.wisedu.com/bower_components/animate.css/animate.min.css" />
    <link rel="stylesheet" type="text/css" href="http://res.wisedu.com/bower_components/sentsinLayer/skin/layer.css" />
    <link rel="stylesheet" type="text/css" href="http://res.wisedu.com/fe_components/bhtc/bhtc-datetimepicker/css/blue/bhtc-datetimepicker.css" />
    <script src="http://res.wisedu.com/fe_components/jquery-1.11.3.js"></script>
    <!-- weekUnitTable -->
    <link rel="stylesheet" type="text/css" href="./weekUnitTable.css" />
    <script src="./weekUnitTable.js"></script>
</head>

<body>
    <input type="button" onclick="setResult()" value="初始化结果" class="bh-btn bh-btn-primary bh-btn-small" style="margin:10px" />
    <input type="button" onclick="getResult()" value="获取结果" class="bh-btn bh-btn-primary bh-btn-small" style="margin:10px" />
    <input type="button" onclick="setReadOnly()" value="只读/可写" class="bh-btn bh-btn-primary bh-btn-small" style="margin:10px" />
    <div class="d" style="width:1000px;margin:10px;"></div>
    <script type="text/javascript">
    var weekUnitTable = new WeekUnitTable({
        container: '.d',
        readOnly: true
    });
    weekUnitTable.render();

    function setResult() {
        weekUnitTable.setResult([{
            unit: '1',
            week: '1'
        }, {
            unit: '2',
            week: '2'
        }, {
            unit: '3',
            week: '3'
        }, {
            unit: '4',
            week: '4'
        }, {
            unit: '5',
            week: '5'
        }]);
    }

    function getResult() {
        var result = weekUnitTable.getResult();
        console.log(result);
    }

    function setReadOnly() {
        if (weekUnitTable.params.readOnly) {
            weekUnitTable.setReadOnly(false);
        } else {
            weekUnitTable.setReadOnly(true);
        }
    }
    </script>
</body>

</html>
